package com.qf.point.controller;

import com.qf.api.point.dto.PointDTO;
import com.qf.common.core.annotation.NoLogin;
import com.qf.common.core.entity.Points;
import com.qf.common.core.utils.R;
import com.qf.point.service.PointsService;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author zdl
 * @date 2025/3/27
 */
@RestController
@RequestMapping("/user/point")
public class PointController {
    @Resource
    private PointsService pointsService;

    @PostMapping("/remote/add")
    public R<?> remoteAddPoint(@RequestBody PointDTO pointDTO) {
        Points points = new Points();
        BeanUtils.copyProperties(pointDTO, points);
        pointsService.addPoint(points);
        return R.ok("调用成功");
    }

    @PostMapping("/remote/add2")
    public R<?> remoteAddPoint2(Integer pointType) {
        pointsService.remoteAddPoint(pointType,null);
        return R.ok("调用成功");
    }

    @NoLogin
    @PostMapping("/remote/add3")
    public R<?> remoteAddPoint3(Integer pointType,Integer uid) {
        pointsService.remoteAddPoint(pointType,uid);
        return R.ok("调用成功");
    }

}
